package com.sky.controller.admin;

import com.sky.result.Result;
import com.sky.utils.AliOssUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.time.LocalDateTime;

@RestController

public class CommonContoller {

    @Autowired
    AliOssUtil ossUtil;

    @PostMapping("/admin/common/upload")
    public Result<String> upload(@RequestBody MultipartFile file) throws IOException {

        String upload = ossUtil.upload(file.getBytes(), file.getOriginalFilename());
        return  Result.success(upload);
    }
}

